home *** CD-ROM | disk | FTP | other *** search
/ infoROM 17,000 Product Descriptions for Business / infoROM Product Descriptions for Business - ESX Interactive.ISO / title.mst < prev    next >
Encoding:
Text File  |  1994-09-07  |  13.7 KB  |  450 lines

  1. '**************************************************************************
  2. '*
  3. '* TITLE.MST - Viewer Runtime Setup Script
  4. '*
  5. '* CUSTOMIZING TITLE.MST
  6. '*
  7. '* For a simple Setup routine, you just need to assign values to the 
  8. '* series of variables following the heading "Setup Variables". This
  9. '* script also provides for the following more-advanced options, which
  10. '* are supported by subroutines located later in this script:
  11. '*
  12. '* Option                                         See Subroutine
  13. '* ------------------------------------------     ---------------------
  14. '* Install more than one .MVB file                ModifyViewerIni
  15. '* Install Help title                             ModifyViewerIni
  16. '* Install custom DLLs                            ModifyViewerIni
  17. '* Install multiple Program Manager items         ModifyProgramManager
  18. '* Display a custom icon with the ProgMan item    ModifyProgramManager
  19. '* Install custom fonts                           RegisterCustomFonts
  20. '* Install Video for Windows runtime files        RegisterDrivers
  21. '*
  22. '* Each customization note starts with the heading CUSTOMIZATION.
  23. '*
  24. '**************************************************************************
  25.     
  26.     '' Global variables
  27.  
  28.     GLOBAL TitleShortName$
  29.     GLOBAL TitleLongName$
  30.     GLOBAL MVBFileName$
  31.     GLOBAL PromptForPath%
  32.     GLOBAL DefaultPath$
  33.     GLOBAL ProgManGroup$
  34.     GLOBAL OtherProgManGroup$
  35.     GLOBAL ProgManItem$
  36.     GLOBAL szTitleDir$
  37.  
  38.     '' ****************************************************************
  39.     '' ** Setup Variables
  40.     '' ****************************************************************
  41.  
  42.     '' Set the following string to a short form of the title name
  43.     '' (for example, "Gallery")
  44.     
  45.     TitleShortName$ = "InfoROM Summer 1994"
  46.     
  47.     '' Set the following string to a long form of the title name
  48.     '' (for example, "Viewer 2.0 Gallery")
  49.     
  50.     TitleLongName$ = "InfoROM Summer 1994"
  51.         
  52.     '' Set the following variable to the name of the MVB file, without 
  53.     '' the filename extension (for example, "GALLERY")
  54.         
  55.     MVBFileName$ = "IROM04"
  56.     
  57.     '' The following variable determines whether Setup prompts the user
  58.     '' to specify a directory in which to install title files. (Files
  59.     '' to be installed on the hard disk must be listed in the TITLE.INF 
  60.     '' file under the [Installed Title Files] section.) Specify one of
  61.     '' the following values:
  62.     ''
  63.     '' 0    Install title files in the Windows directory (default setting).
  64.     ''      This is an appropriate setting if you have a limited number
  65.     ''      of files to copy (for example, a single custom icon or DLL).
  66.     ''
  67.     '' 1    Display a dialog box to prompt the user for a directory in 
  68.     ''      which to install files
  69.         
  70.     PromptForPath% = 1
  71.         
  72.     '' If you have specified 1 in PromptForPath%, set the following 
  73.     '' variable to the default path that will be displayed in the dialog
  74.     '' box (for example, "C:\GALLERY").
  75.         
  76.     DefaultPath$ = "C:\INFOROM"
  77.     
  78.     '' Set the following variable to the name of the program manager 
  79.     '' group you would like to create (for example, "Viewer 2.0 Gallery")
  80.         
  81.     ProgManGroup$ = "ICP InfoROM"
  82.     
  83.     '' Set the following variable to the caption of the program manager 
  84.     '' item for your title (for example, "Gallery")
  85.         
  86.     ProgManItem$ = "ICP InfoROM Summer 1994"
  87.     
  88.     '***********************************************************************
  89.     '** Mainline
  90.     '***********************************************************************
  91.  
  92.     GLOBAL CUIDLL$
  93.  
  94.     '' Include files
  95.     '$INCLUDE 'setupapi.inc'
  96.     
  97.     '' Custom UI dll
  98.     CUIDLL$ = "mscuistf.dll"
  99.     
  100.     '' Dialog ID's
  101.     CONST DESTPATH      = 1000
  102.     CONST APPHELP       = 2000
  103.     CONST TOOBIG        = 3000
  104.     CONST BADPATH       = 4000
  105.     CONST SUCCESS       = 5000
  106.     
  107.     '' Bitmap ID
  108.     CONST LOGO = 1
  109.     
  110.     '' Functions and subroutines
  111.     DECLARE FUNCTION AddFont LIB "mscuistf.dll" (szFont$, szName$) AS INTEGER
  112.     DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  113.     DECLARE FUNCTION GetTitleDir (szDefault$) AS STRING
  114.     DECLARE FUNCTION CopyFiles(szTitleDir$) AS INTEGER
  115.     DECLARE SUB RegisterFont(fontfile$, fontname$)
  116.     DECLARE SUB ModifyViewerIni
  117.     DECLARE SUB RegisterCustomFonts
  118.     DECLARE SUB ModifyProgramManager
  119.     DECLARE SUB ShowSuccess
  120.     DECLARE SUB RegisterDrivers
  121.     
  122.     '' The following statement turns size checking off. Set it to scmOnFatal 
  123.     '' to enable size checking, where Setup will compare the disk file size 
  124.     '' with the INF file size and report an error if they are not the same.
  125.     
  126.     i% = SetSizeCheckMode(scmOff)
  127.     
  128.     '' Set the title and banner bitmap. You must rebuild MSCUISTF.DLL to 
  129.     '' alter the banner bitmap.
  130.     
  131.     SetTitle "ICP Inforom CD-ROM Setup"
  132.     SetBitmap CUIDLL$, LOGO 
  133.     
  134.     '' Read in the INF file.
  135.     
  136.     ReadInfFile GetSymbolValue("STF_CWDDIR") + "TITLE.INF"
  137.     
  138.     '' Decide where to put title files
  139.     IF PromptForPath% = 1 THEN
  140.         szTitleDir$ = GetTitleDir(DefaultPath$)
  141.         IF szTitleDir$ = "" THEN
  142.             GOTO QUIT
  143.         ENDIF
  144.     ELSE
  145.         szTitleDir$ = GetWindowsDir()
  146.     ENDIF   
  147.     
  148.     '' Copy files
  149.     IF CopyFiles(szTitleDir$) = 0 THEN
  150.         GOTO QUIT
  151.     ENDIF
  152.  
  153.     '' Create the MVIEWER2.EXE MVB association 
  154.     CreateIniKeyValue "WIN.INI", "Extensions", "MVB", "mviewer2.exe", cmoNone
  155.  
  156.     '' Register in VIEWER.INI
  157.     ModifyViewerIni
  158.  
  159.     '' Register custom fonts
  160.     RegisterCustomFonts
  161.  
  162.     '' Register drivers
  163.     RegisterDrivers
  164.     
  165.     '' Modify Program Manager
  166.     ModifyProgramManager    
  167.     
  168. QUIT:
  169.     
  170.     END
  171.     
  172.  
  173. '*************************************************************************
  174. '** Purpose:
  175. '**     Prompts the user for a path for the title files
  176. '** Arguments:
  177. '**     szDefault$ - default path
  178. '** Returns:
  179. '**     New valid path name, or "" if the user quit.
  180. '*************************************************************************
  181.  
  182. FUNCTION GetTitleDir (szDefault$) STATIC AS STRING
  183.  
  184.     SetSymbolValue "String", TitleShortName$
  185.     SetSymbolValue "EditTextIn", szDefault$
  186.     SetSymbolValue "EditFocus", "ALL"
  187.                    
  188.     GETPATH:
  189.  
  190.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, "FHelpDlgProc")
  191.  
  192.     IF sz$ = "CONTINUE" THEN
  193.         szTitleDir$ = GetSymbolValue("EditTextOut")
  194.         IF IsDirWritable(szTitleDir$) = 0 THEN
  195.  
  196.             BADPATH:
  197.  
  198.             sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfoDlgProc", 0, "")
  199.             IF sz$ = "REACTIVATE" THEN
  200.                 GOTO BADPATH
  201.             END IF
  202.             UIPop 1
  203.             GOTO GETPATH
  204.         END IF
  205.         UIPop 1
  206.         CreateDir szTitleDir$, cmoNone
  207.  
  208.     ELSEIF sz$ = "REACTIVATE" THEN
  209.         GOTO GETPATH
  210.  
  211.     ELSE
  212.         szTitleDir$ = ""
  213.  
  214.     END IF
  215.  
  216.     GetTitleDir = szTitleDir$
  217.  
  218. END FUNCTION
  219.  
  220.  
  221. '*************************************************************************
  222. '** Purpose:
  223. '**     Copies the files in the INF file
  224. '** Arguments:
  225. '**     szTitleDir$ - destination directory for the title files
  226. '** Returns
  227. '**     1 if files were copied, 0 otherwise
  228. '*************************************************************************
  229.  
  230. FUNCTION CopyFiles(szTitleDir$) STATIC AS INTEGER
  231.  
  232.     '' Add all system files to the copy list
  233.     AddSectionFilesToCopyList "System Files", GetSymbolValue("STF_SRCDIR"), GetWindowsSysDir()
  234.     
  235.     '' Add all of the title files to the copy list
  236.     AddSectionFilesToCopyList "Installed Title Files", GetSymbolValue("STF_SRCDIR"), szTitleDir$
  237.     
  238.     '' Check size
  239.     szExtras$ = "Extra"
  240.     szCosts$ = "Costs"
  241.     szNeededs$ = "Neededs"
  242.     FOR i% = 1 TO 26 STEP 1
  243.         AddListItem szExtras$, "0"
  244.     NEXT i%
  245.     
  246.     '' We assume that VIEWER.INI will take another 4K
  247.     ReplaceListItem szExtras$, ASC(MID$(UCASE$(GetWindowsDir()), 1, 1)) - ASC("A") + 1, STR$(4096)
  248.     
  249.     '' Get amount of space required
  250.     StillNeed& = GetCopyListCost(szExtras$, szCosts$, szNeededs$)
  251.     
  252.     '' Put up a message if there is not enough space
  253.     FOR i% = 1 TO 26 STEP 1
  254.         IF VAL(GetListItem(szNeededs$, i%)) > 0 THEN
  255.     
  256.             SetSymbolValue "String1", LTRIM$(STR$(VAL(GetListItem(szCosts$, i%)) / 1024))
  257.             SetSymbolValue "String2", CHR$(i% - 1 + ASC("A"))
  258.     
  259.             TOOBIG:
  260.     
  261.             sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc", 0, "")
  262.             IF sz$ = "REACTIVATE" THEN
  263.                 GOTO TOOBIG
  264.             END IF
  265.             UIPop 1
  266.             CopyFiles = 0
  267.             GOTO DONTCOPY
  268.         END IF
  269.     NEXT i%
  270.     
  271.     '' Copy the files
  272.     CopyFilesInCopyList
  273.     
  274.     CopyFiles = 1
  275.  
  276. DONTCOPY:
  277.  
  278. END FUNCTION
  279.  
  280.  
  281. '*************************************************************************
  282. '** Purpose:
  283. '**     Puts up a success dialog
  284. '*************************************************************************
  285.  
  286. SUB ShowSuccess STATIC
  287.  
  288.     SUCCESS:
  289.     
  290.     SetSymbolValue "String1", TitleShortName$
  291.     sz$ = UIStartDlg(CUIDLL$, SUCCESS, "FInfoDlgProc", 0, "")
  292.     IF sz$ = "REACTIVATE" THEN
  293.         GOTO SUCCESS
  294.     END IF
  295.     UIPop 1
  296.     
  297. END SUB
  298.  
  299.  
  300. '*************************************************************************
  301. '** Purpose:
  302. '**     Appends a file name to the end of a directory path,
  303. '**     inserting a backslash character as needed.
  304. '** Arguments:
  305. '**     szDir$  - full directory path (with optional ending "\")
  306. '**     szFile$ - filename to append to directory
  307. '** Returns:
  308. '**     Resulting fully qualified path name.
  309. '*************************************************************************
  310.  
  311. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  312.     IF szDir$ = "" THEN
  313.         MakePath = szFile$
  314.     ELSEIF szFile$ = "" THEN
  315.         MakePath = szDir$
  316.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  317.         MakePath = szDir$ + szFile$
  318.     ELSE
  319.         MakePath = szDir$ + "\" + szFile$
  320.     END IF
  321. END FUNCTION
  322.  
  323.  
  324. '*************************************************************************
  325. '** Purpose:
  326. '**     Registers a font.
  327. '** Arguments:
  328. '**     fontfile$ - font filename
  329. '**     fontname$ - font name.
  330. '*************************************************************************
  331.  
  332. SUB RegisterFont(fontfile$, fontname$) STATIC
  333.  
  334.     '' A simple error catching wrapper around AddFont, which is a 'C' routine in MSCUISTF.DLL
  335.  
  336.     IF AddFont(fontfile$, fontname$) = -1 THEN
  337.         j% = DoMsgBox("Could not install " + fontfile$ + " font.", "Viewer Font Installation", 0)
  338.     ENDIF
  339.  
  340. END SUB
  341.  
  342.  
  343. '*************************************************************************
  344. '** Purpose:
  345. '**     Registers title in VIEWER.INI
  346. '*************************************************************************
  347.  
  348. SUB ModifyViewerIni STATIC
  349.  
  350.     '' Get the VIEWER.INI file
  351.     
  352.     szIni$ = MakePath(GetWindowsDir(), "VIEWER.INI")
  353.  
  354.     '' First register the title file, setting the Name and Path entries. 
  355.     '' We assume that the MVB file is the same directory as SETUP.EXE.
  356.     ''
  357.     '' CUSTOMIZATION: If you're installing multiple MVB files, copy the
  358.     '' following two statements for each additional file, substituting
  359.     '' the appropriate long name and MVB filename for the TitleLongName$
  360.     '' and MVBFileName$ variables.
  361.     
  362.     CreateIniKeyValue szIni$, MVBFileName$, "Name", TitleLongName$, cmoOverwrite
  363.     CreateIniKeyValue szIni$, MVBFileName$, "Path", GetSymbolValue("STF_SRCDIR"), cmoOverwrite
  364.     
  365.     '' Now we have to register the MVB file in the [FILES] section, so 
  366.     '' Viewer can find files that are not on the path and display a 
  367.     '' special message when a file is not found.
  368.  
  369.     CreateIniKeyValue szIni$, "FILES", MVBFileName$ + ".MVB", GetSymbolValue("STF_SRCDIR") + "," + "Please insert the " + TitleLongName$ + " disk.", cmoOverwrite
  370.  
  371. END SUB
  372.  
  373.  
  374. '*************************************************************************
  375. '** Purpose:
  376. '**     Creates program manager entries for the title
  377. '*************************************************************************
  378.  
  379. SUB ModifyProgramManager STATIC
  380.  
  381.     '' Create the program manager groups
  382.     CreateProgmanGroup ProgmanGroup$, "", cmoNone
  383.     ShowProgmanGroup ProgmanGroup$, 1, cmoNone
  384.  
  385.     CreateProgmanItem ProgmanGroup$, ProgmanItem$, "mviewer2.exe " + MakePath(GetSymbolValue("STF_SRCDIR"), MVBFileName$ + ".MVB"), MakePath(szTitleDir$,"inforom.ico,0,,,")+GetSymbolValue("STF_SRCDIR"), cmoOverwrite
  386.     
  387. END SUB
  388.  
  389.  
  390. '*************************************************************************
  391. '** Purpose:
  392. '**     Registers custom fonts with Windows.
  393. '*************************************************************************
  394.  
  395. SUB RegisterCustomFonts STATIC
  396.  
  397.     '' CUSTOMIZATION: If you install custom fonts, then add statements
  398.     '' in this routine to register the fonts with the current Windows 
  399.     '' session and to add them to the WIN.INI [Fonts] section. 
  400.     ''
  401.     '' Note that TrueType fonts can only be installed in Windows 3.1.
  402.     '' RegisterFont automatically creates the required .FOT file for 
  403.     '' TrueType fonts.
  404.     ''    
  405.     '' The following example registers a font residing in MISTRAL.TTF
  406.     '' and installs the font with the name Mistral (True Type):
  407.     '' 
  408.     ''     RegisterFont "mistral.ttf", "Mistral (TrueType)"
  409.     ''
  410.  
  411. END SUB
  412.  
  413.  
  414. '*************************************************************************
  415. '** Purpose:
  416. '**     Registers Windows drivers
  417. '*************************************************************************
  418.  
  419. SUB RegisterDrivers STATIC
  420.  
  421. '' CUSTOMIZATION: Video for Windows is not a standard component of
  422. '' Windows 3.1. If your title uses video, proceed as follows.
  423. ''
  424. '' 1) Add the following files to the [System Files] section of the INF file:
  425. ''
  426. ''    dispdib.dll
  427. ''    msvideo.dll
  428. ''    indeo.drv
  429. ''    mciavi.drv
  430. ''    msvidc.drv
  431. ''
  432. '' 2) Add the above files to your release directory. US versions can be 
  433. ''    found in the \SYSTEM subdirectory of your Viewer disc. French and
  434. ''    German versions were not available at ship time. Please contact 
  435. ''    Microsoft or check the Multimedia Viewer section on the Microsoft
  436. ''    Compuserve Forum for further details.
  437. ''
  438. '' 3) Uncomment the following lines:
  439. ''
  440. '' CreateIniKeyValue "WIN.INI", "mci extensions", "AVI", "AVIVIDEO", cmoNone
  441. '' CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "mci", "AVIVIDEO", "MCIAVI.DRV", cmoNone
  442. '' CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "drivers", "vidc.msvc", "msvidc.drv", cmoNone
  443. '' CreateIniKeyValue MakePath(GetWindowsDir(), "SYSTEM.INI"), "drivers", "vidc.rt21", "indeo.drv", cmoNone
  444.  
  445. END SUB
  446.  
  447.  
  448.  
  449.  
  450.